package user;

import Operation.impl.*;

import java.util.Scanner;

public class NormalUser extends User {
    private Scanner scanner=new Scanner(System.in);
    public NormalUser(String name){  //操作权限的初始化
        this.name=name;
        this.operations= new Operation.IOperation[]{
                new DisplayOperation(),
                new FindOperation(),
                new BorrowOperation(),
                new ReturnOperation()
        };
    }

    /**
     * 普通用户菜单————普通用户可以进行额操作
     * @return
     */
    @Override
    public int menu() {
        System.out.println("=======================================");
        System.out.println("欢迎" + this.name + "登录比特图书管理系统");
        System.out.println("1.显示当前的书籍列表");
        System.out.println("2.查询书籍");
        System.out.println("3.借阅书籍");
        System.out.println("4.归还书籍");
        System.out.println("-1.退出");
        System.out.println("请输入您的选择:");
        int choice = scanner.nextInt();
        if (choice == -1) {
            // 关闭输入
            scanner.close();
        }
        System.out.println("=======================================");
        return choice;
    }
}
